package io;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * @Author: wenjingyuan
 * @Date: 2023/05/29/20:33
 * @Description:
 */
public class OutputStreamDemo2 {
    public static void main(String[] args) throws IOException {
        File file=new File("mytest.txt");
        if(!file.exists()){
            System.out.println("文件创建："+file.createNewFile());
        }
        //文件写入操作
        try(OutputStream outputStream=new FileOutputStream(file)){
            byte[] bytes=new byte[]{
                    'H','i'
            };
            outputStream.write(bytes);
            outputStream.flush();
        }
    }
}
